home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / gs3.53 / ppath.ps < prev    next >
Text File  |  1996-01-10  |  2KB  |  55 lines

  1. %    Copyright (C) 1989, 1995 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % Redefine pathforall for tracing.
  16. % Can't be used recursively.
  17.  
  18. /# {( )print} def
  19.  
  20. /-mat matrix def
  21. /-imat matrix def
  22. /-smat { //-mat currentmatrix pop //-imat setmatrix } bind def
  23. /-rmat { //-mat setmatrix } bind def
  24. /-pathforall /pathforall load def
  25. /-p2 { ( ) print exch =only ( ) print =only } bind def
  26. /-dp2 { 2 copy -p2 2 { exch 4096 mul dup cvi dup ( ) print =only sub dup 0 eq { pop } { (+) print =only } ifelse } repeat } bind def
  27. /-tp2 { //-mat transform -p2 } bind def
  28. /-dict 5 dict def
  29.  
  30. /pathforall
  31.  { -dict begin
  32.    /-close exch def  /-curve exch def  /-line exch def  /-move exch def
  33.    end -smat
  34.    {2 copy -dp2 ( moveto\t%)print
  35.     2 copy -tp2 (\n)print
  36.     flush -dict /-move get -rmat exec -smat}
  37.    {2 copy -dp2 ( lineto\t%)print
  38.     2 copy -tp2 (\n)print
  39.     flush -dict /-line get -rmat exec -smat}
  40.    {5 index 5 index -dp2 3 index 3 index -dp2 2 copy -dp2 ( curveto\t%)print
  41.     5 index 5 index -tp2 3 index 3 index -tp2 2 copy -tp2 (\n)print
  42.     flush -dict /-curve get -rmat exec -smat}
  43.    {(closepath\n)print flush   -dict /-close get -rmat exec -smat}
  44.    -pathforall -rmat
  45.   }
  46.  def
  47.  
  48. % Just print the current path
  49.  
  50. /printpath
  51.  { {pop pop} {pop pop} {pop pop pop pop pop pop} {} pathforall } def
  52.